<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>调查人员意见及承诺</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
 <div class="Wrapper">
	   <div class="pageIn2layout">
	<jsp:include page="../../project/prjbscinfo/prjInvestRpt.jsp" flush="true" >
			<jsp:param name="currentNav" value="prjcstinvestrpt"/>
	</jsp:include>
	<div class="pageIn2L_mid">
           <div id="pageInTab" class="pageInTab">
                    <form id="prj_cst_invest_rpt_form">
                        <div class="fieldset1 tabel_col clearFix">
		                      <div class="fieldBox col_100">
				                    <div class="label">意见：</div>
				                    <div class="field">
				                        <input name="sugg"  id="sugg" type="text" class="ui-textbox" value="${prjCstInvestRpt.sugg }" >
				                    </div>
		               		 </div>
                                 <div class="fieldBox col_100">
                                <div class="label">承诺：</div>
                                <div class="field">
  									 <span>承诺：本人承诺承租人信息已现场核实，并对承租人做了尽职调查。<br/>并现场监督了客户在租赁合同及相关法律文件上的签字用印，对其真实性进行了核实。<br/>向公司提供的承租人相关权证资料包括但不限于车辆销售发票、车辆保单、车辆登记证书、车辆钥匙及法律文件等资料和手续真实有效。<br/>若由于上述法律文件及资料真实性原因导致公司权益受到侵害，我个人愿意承担一切责任。</span>
                                   </div>
                            </div>
                                <div class="fieldBox col_50">
                                <div class="label">报告类型：</div>
                                <div class="field">
                                 <select name="cstRptTypCd"  id="cstRptTypCd"   >
	                                <c:forEach items="${keyList}" var="opt">
	                                 <option value="${opt.key}"
	                                 <c:if test="${opt.key==prjCstInvestRpt.cstRptTypCd }">selected="selected"</c:if>
	                                 >${opt.value}</option>
	                                </c:forEach>
	                                </select>
                                </div>
                            </div>
                              <div class="fieldBox col_50">
                                <div class="label">调查人员签字：</div>
                                <div class="field">
                                <input name="investor" id="investor"  type="text"  class="ui-textbox" value="${prjCstInvestRpt.investor }" >
                                </div>
                            </div>
                            <div class="fieldBox col_50">
                                <div class="label">日期</div>
                                <div class="field"> 
                              		<input name="rptDt" id="rptDt" type="text"  class="ui-datepicker"  value="${prjCstInvestRpt.rptDt }" >
                                </div>
                            </div>
                              <div class="fieldBox col_50"  style="display: none">
                                <div class="field"> 
                              		<input name="rptId" id="rptId" type="text"  value="${prjCstInvestRpt.id }" >
                                </div>
                            </div>
                            </div>
                    </form>
                    </div>
                     <div class="btnsBox">
				                <span id="prj_cst_invest_rpt_add_btn_id" class="sq-button sq-button-round" onclick="save();"><!-- <i class="sqBtnIco_10"></i> -->保存</span>
           				 </div>
           </div>
		</div>
	</div>
<script type="text/javascript">
var prjId = '${prjId}';
var cstId = '${cstId}';
var detailFlag = '${detailFlag}';
var cstRlCd = '${cstRlCd}';
$(function () {
	initData();
	if(detailFlag=="true"){
		$("#prj_cst_invest_rpt_add_btn_id").hide();
		if($("#sugg")){
		 $("#sugg").attr("readonly","readonly");
		}
		if($("#investor")){
			 $("#investor").attr("readonly","readonly");
			}
		if(liger.get("rptDt")){
			  liger.get("rptDt").setDisabled(true);
		 } 	
		if(liger.get("cstRptTypCd")){
			  liger.get("cstRptTypCd").setDisabled(true);
		 } 	
	}
});

	//初始化数据
	function initData(){
		setFormatDateValue();
		$("#prj_cst_invest_rpt_form").ligerForm({
		    validate: true
		});
	}
	
	//设置日期值
	function setFormatDateValue(){
		var rptDt =$("#rptDt").val();
		if(rptDt){
	    	var rptDt = DateUtils.formatDate(new Date(rptDt),DateUtils.YYYY_MM_DD);
	    	$("#rptDt").val(rptDt);//日期
	    	}
		
	}
	function save(){
        var ligerForm = liger.get("prj_cst_invest_rpt_form");
        if (!ligerForm.valid()) {
            top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = ligerForm.getData();
        data["rptDt"] = $("#rptDt").val();
        var url = '<%=path%>/project/prjcstinvestrpt/add.do';
        var rptId = $("#rptId").val();
        data["id"]= rptId;
        data["prjId"]= prjId;
        data["cstId"]= cstId;
        data["cstRlCd"] = cstRlCd;
        var wait_dialog;
        $.ajax({
    		type: 'post',
    		dataType:'json',
    		data:data,
    		url: url,
    		beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
    		success:function(msg){
    			 wait_dialog.close();
    			 if(msg.success == 1){
    				 $("#rptId").val(msg.data);
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
    			 }else{
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
    			 }
    		}
    	});
	}
    </script>
</body>
</html>